package com.io;

import java.io.File;
import java.io.FilenameFilter;

public class FileMain {

    public static void main(String[] args) {
//        System.out.println("hello world");

        String path = "/home/mls";
        File f = new File(path);
//        printFile(f.listFiles());

        File[] f2 = f.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                return name.endsWith(".png");
            }
        });
        printFile(f2);
    }

    static void printFile(File[] files) {
        for (File file: files) {
            if (file != null) {
                System.out.println(file);
            }
        }
    }
}
